import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { IndicatorVO, IndicatorForm, IndicatorQuery } from '@/api/system/indicator/types';

/**
 * 查询报警管理列表
 * @param query
 * @returns {*}
 */

export const listIndicator = (query?: IndicatorQuery): AxiosPromise<IndicatorVO[]> => {
  return request({
    url: '/system/indicator/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询报警管理详细
 * @param id
 */
export const getIndicator = (id: string | number): AxiosPromise<IndicatorVO> => {
  return request({
    url: '/system/indicator/' + id,
    method: 'get'
  });
};

/**
 * 新增报警管理
 * @param data
 */
export const addIndicator = (data: IndicatorForm) => {
  return request({
    url: '/system/indicator',
    method: 'post',
    data: data
  });
};

/**
 * 修改报警管理
 * @param data
 */
export const updateIndicator = (data: IndicatorForm) => {
  return request({
    url: '/system/indicator',
    method: 'put',
    data: data
  });
};

/**
 * 删除报警管理
 * @param id
 */
export const delIndicator = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/indicator/' + id,
    method: 'delete'
  });
};

/**
 * 获取监测项类型列表
 */
export const getIndicatorTypeList = () => {
  return request({
    url: '/system/query/match/list/indicator_type',
    method: 'get'
  });
};

/**
 * 获取监测点位详细信息
 * @param id
 */
export const getIndicatorInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/indicator' + id,
    method: 'get'
  });
};
